1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
16 * The Original Code is mozilla.org code.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1998
21 * the Initial Developer. All Rights Reserved.
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK *****
40 * This Original Code has been modified by IBM Corporation.
41 * Modifications made by IBM described herein are
42 * Copyright (c) International Business Machines
45 * Modifications to Mozilla code or documentation
46 * identified per MPL Section 3.3
48 * Date Modified by Description of modification
49 * 03/27/2000 IBM Corp. Set JNICALL to Optlink for
53 /*******************************************************************************
54 * Netscape version of jni_md.h -- depends on jri_md.h
55 ******************************************************************************/
60 #include "prtypes.h" /* needed for _declspec */
62 /*******************************************************************************
63 * WHAT'S UP WITH THIS FILE?
65 * This is where we define the mystical JNI_PUBLIC_API macro that works on all
66 * platforms. If you're running with Visual C++, Symantec C, or Borland's
67 * development environment on the PC, you're all set. Or if you're on the Mac
68 * with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't
71 * Changes by sailesh on 9/26
73 * There are two symbols used in the declaration of the JNI functions
74 * and native code that uses the JNI:
75 * JNICALL - specifies the calling convention
76 * JNIEXPORT - specifies export status of the function
78 * The syntax to specify calling conventions is different in Win16 and
79 * Win32 - the brains at Micro$oft at work here. JavaSoft in their
80 * infinite wisdom cares for no platform other than Win32, and so they
81 * just define these two symbols as:
83 #define JNIEXPORT __declspec(dllexport)
84 #define JNICALL __stdcall
86 * We deal with this, in the way JRI defines the JRI_PUBLIC_API, by
87 * defining a macro called JNI_PUBLIC_API. Any of our developers who
88 * wish to use code for Win16 and Win32, _must_ use JNI_PUBLIC_API to
89 * be able to export functions properly.
91 * Since we must also maintain compatibility with JavaSoft, we
92 * continue to define the symbol JNIEXPORT. However, use of this
93 * internally is deprecated, since it will cause a mess on Win16.
95 * We _do not_ need a new symbol called JNICALL. Instead we
96 * redefine JNICALL in the same way JRI_CALLBACK was defined.
98 ******************************************************************************/
100 /* DLL Entry modifiers... */
102 #if defined(XP_WIN) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32)
103 # include <windows.h>
104 # if defined(_MSC_VER) || defined(__GNUC__)
105 # if defined(WIN32) || defined(_WIN32)
106 # define JNI_PUBLIC_API(ResultType) _declspec(dllexport) ResultType __stdcall
107 # define JNI_PUBLIC_VAR(VarType) VarType
108 # define JNI_NATIVE_STUB(ResultType) _declspec(dllexport) ResultType
109 # define JNICALL __stdcall
111 # if defined(_WINDLL)
112 # define JNI_PUBLIC_API(ResultType) ResultType __cdecl __export __loadds
113 # define JNI_PUBLIC_VAR(VarType) VarType
114 # define JNI_NATIVE_STUB(ResultType) ResultType __cdecl __loadds
115 # define JNICALL __loadds
117 # define JNI_PUBLIC_API(ResultType) ResultType __cdecl __export
118 # define JNI_PUBLIC_VAR(VarType) VarType
119 # define JNI_NATIVE_STUB(ResultType) ResultType __cdecl __export
120 # define JNICALL __export
121 # endif /* !WINDLL */
122 # endif /* !_WIN32 */
123 # elif defined(__BORLANDC__)
124 # if defined(WIN32) || defined(_WIN32)
125 # define JNI_PUBLIC_API(ResultType) __export ResultType
126 # define JNI_PUBLIC_VAR(VarType) VarType
127 # define JNI_NATIVE_STUB(ResultType) __export ResultType
130 # define JNI_PUBLIC_API(ResultType) ResultType _cdecl _export _loadds
131 # define JNI_PUBLIC_VAR(VarType) VarType
132 # define JNI_NATIVE_STUB(ResultType) ResultType _cdecl _loadds
133 # define JNICALL _loadds
136 # error Unsupported PC development environment.
138 # ifndef IS_LITTLE_ENDIAN
139 # define IS_LITTLE_ENDIAN
141 /* This is the stuff inherited from JavaSoft .. */
142 # define JNIEXPORT __declspec(dllexport)
143 # define JNIIMPORT __declspec(dllimport)
146 #elif defined(XP_OS2)
148 # define JNI_PUBLIC_API(ResultType) ResultType _System
149 # define JNI_PUBLIC_VAR(VarType) VarType
150 # define JNICALL _Optlink
153 # elif defined(__declspec)
154 # define JNI_PUBLIC_API(ResultType) __declspec(dllexport) ResultType
155 # define JNI_PUBLIC_VAR(VarType) VarType
156 # define JNI_NATIVE_STUB(ResultType) __declspec(dllexport) ResultType
161 # define JNI_PUBLIC_API(ResultType) ResultType
162 # define JNI_PUBLIC_VAR(VarType) VarType
167 # ifndef IS_LITTLE_ENDIAN
168 # define IS_LITTLE_ENDIAN
172 #elif macintosh || Macintosh || THINK_C
173 # if defined(__MWERKS__) /* Metrowerks */
174 # if !__option(enumsalwaysint)
175 # error You need to define 'Enums Always Int' for your project.
177 # if defined(TARGET_CPU_68K) && !TARGET_RT_MAC_CFM
178 # if !__option(fourbyteints)
179 # error You need to define 'Struct Alignment: 68k' for your project.
181 # endif /* !GENERATINGCFM */
182 # define JNI_PUBLIC_API(ResultType) __declspec(export) ResultType
183 # define JNI_PUBLIC_VAR(VarType) JNI_PUBLIC_API(VarType)
184 # define JNI_NATIVE_STUB(ResultType) JNI_PUBLIC_API(ResultType)
185 # elif defined(__SC__) /* Symantec */
186 # error What are the Symantec defines? (warren@netscape.com)
187 # elif macintosh && applec /* MPW */
188 # error Please upgrade to the latest MPW compiler (SC).
190 # error Unsupported Mac development environment.
193 /* This is the stuff inherited from JavaSoft .. */
199 # define JNI_PUBLIC_API(ResultType) ResultType
200 # define JNI_PUBLIC_VAR(VarType) VarType
201 # define JNI_NATIVE_STUB(ResultType) ResultType
203 /* This is the stuff inherited from JavaSoft .. */
208 #ifndef FAR /* for non-Win16 */
212 /* Get the rest of the stuff from jri_md.h */
215 #endif /* JNI_MD_H */